package org.abluedog.ssfb.utils;

import org.abluedog.ssfb.pdc.BodyComposition;
import org.abluedog.ssfb.pdc.BodyCompositionPDC;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;

public class SsfbUtil {


    public static BodyComposition getBodyCompositionByPlayer(Player player, Plugin plugin){
        NamespacedKey growth = new NamespacedKey(plugin, "player-body-composition-" + player.getUniqueId());
        if (player.getPersistentDataContainer().has(growth, new BodyCompositionPDC())){
            return player.getPersistentDataContainer().get(growth, new BodyCompositionPDC());
        }
        return new BodyComposition();
    }

    public static void sendBodyCompositionMsg(Player player, BodyComposition bodyCompositionByPlayer) {
        player.sendMessage("§f§lBody Composition§r§f");
        player.sendMessage("§fAge: §r§f" + bodyCompositionByPlayer.getAge());
        player.sendMessage("§fHeight: §r§f" + bodyCompositionByPlayer.getHeight());
        player.sendMessage("§fWeight: §r§f" + bodyCompositionByPlayer.getWeight());
        player.sendMessage("§fBMR: §r§f" + bodyCompositionByPlayer.getBmr());
        player.sendMessage("§fProtein Mass: §r§f" + bodyCompositionByPlayer.getProteinMass());
        player.sendMessage("§fMuscle Mass: §r§f" + bodyCompositionByPlayer.getMuscleMass());
        player.sendMessage("§fFat Mass: §r§f" + bodyCompositionByPlayer.getFatMass());
        player.sendMessage("§fWater Mass: §r§f" + bodyCompositionByPlayer.getWaterMass());
    }
}
